﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;

namespace Business.Models
{
    public class MonHoc_LopHoc
    {
        [Key]
        public int IdMonHoc_LopHoc { get; set; }
        //public int IdMonHoc { get; set; }
        public virtual MonHoc MonHoc { get; set; }
        //public int IdLopHoc { get; set; }
        public virtual LopHoc LopHoc { get; set; }
        public bool HoatDong { get; set; }
        //public int IdNhanVien { get; set; }
        public virtual QuanTri QuanTri { get; set; }
    }

    public class MonHoc_LopHocConfiguration : EntityTypeConfiguration<MonHoc_LopHoc>
    {

        public MonHoc_LopHocConfiguration()
            : base()
        {

            HasKey(d => d.IdMonHoc_LopHoc);
            Property(d => d.IdMonHoc_LopHoc).
                HasColumnName("IdMonHoc_LopHoc").
                HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity).
                IsRequired();
            HasRequired(x => x.MonHoc).
            WithMany().
                Map(x => x.MapKey("IdMonHoc"));
            HasRequired(x => x.LopHoc).
            WithMany().
                Map(x => x.MapKey("IdLopHoc"));
            Property(d => d.HoatDong).
                HasColumnName("HoatDong").
                IsRequired();
            HasRequired(x => x.QuanTri).
            WithMany().
                Map(x => x.MapKey("IdNhanVien"));
            ToTable("MonHoc_LopHoc", "dbo");
        }

    }
}